﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace IntervalTimer
{
    /// <summary>
    /// Interaction logic for NewTimerWindow.xaml
    /// </summary>
    public partial class NewTimerWindow : Window
    {
        public NewTimerWindow()
        {
            InitializeComponent();
        }

        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            try
            { 
                ((MainWindow)this.Owner).Workout.Timers.Add(new Timer(int.Parse(HourTBox.Text), int.Parse(MinTBox.Text), int.Parse(SecTBox.Text)));
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message,"Error");
            }
            this.Close();
        }

        private void Cancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
